/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.proyectos.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Jose
 */
@Entity
@Table(name = "directores")
@NamedQueries({
@NamedQuery(name = "Directores.findAll", query = "SELECT d FROM Directores d"),
@NamedQuery(name = "Directores.findByNcodigo", query = "SELECT d FROM Directores d WHERE d.ncodigo = :ncodigo"),
@NamedQuery(name = "Directores.findByCodigo", query = "SELECT d FROM Directores d WHERE upper(d.ccodigo) = :ccodigo and d.ncarrera = :ncarrera "),
@NamedQuery(name = "Directores.findByAll", query = "SELECT d FROM Directores d WHERE  d.ncarrera = :ncarrera "),
@NamedQuery(name = "Directores.findByName", query = "SELECT d FROM Directores d WHERE upper(d.cnombre) like :cnombre and d.ncarrera = :ncarrera")})
public class Directores implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
   // @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column
    private BigDecimal ncodigo;
   
    @Column
    private String cnombre;
   
    @Column
    private String capellidos;
    
    @Column
    private String ctelefono;
  
    @Column
    private String cdespacho;
  
    @Column
    private String cmail;
    @Column
    private String ccodigo;
    @Column
    private String cpassword;

    public String getCpassword() {
        return cpassword;
    }

    public void setCpassword(String cpassword) {
        this.cpassword = cpassword;
    }
    public String getCcodigo() {
        return ccodigo;
    }

    public void setCcodigo(String ccodigo) {
        this.ccodigo = ccodigo;
    }
    public Directores() {
    }

    @ManyToOne
    @JoinColumn(name="ncarrera")
    private Carreras ncarrera;

    public Carreras getNcarrera() {
        return ncarrera;
    }

    public void setNcarrera(Carreras ncarrera) {
        this.ncarrera = ncarrera;
    }

    
      
      
    public BigDecimal getNcodigo() {
        return ncodigo;
    }

    public void setNcodigo(BigDecimal ncodigo) {
        this.ncodigo = ncodigo;
    }

    public String getCnombre() {
        return cnombre;
    }

    public void setCnombre(String cnombre) {
        this.cnombre = cnombre;
    }
    
    public String getCapellidos() {
        return capellidos;
    }

    public void setCapellidos(String capellidos) {
        this.capellidos = capellidos;
    }
    

    public String getCtelefono() {
        return ctelefono;
    }

    public void setCtelefono(String ctelefono) {
        this.ctelefono = ctelefono;
    }

    public String getCdespacho() {
        return cdespacho;
    }

    public void setCdespacho(String cdespacho) {
        this.cdespacho = cdespacho;
    }

    public String getCmail() {
        return cmail;
    }

    public void setCmail(String cmail) {
        this.cmail = cmail;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 23 * hash + Objects.hashCode(this.ccodigo);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Directores other = (Directores) obj;
        if (!Objects.equals(this.ccodigo, other.ccodigo)) {
            return false;
        }
        return true;
    }
   public String getNombre()
   {
       return this.capellidos+", "+this.cnombre;
   }
    
}
